package com.probiz.estore.content.service.impl;

import java.util.List;

import com.probiz.estore.Constants;
import com.probiz.estore.common.model.content.NewsletterGroup;
import com.probiz.estore.core.service.impl.GenericManagerImpl;
import com.probiz.estore.content.service.NewsletterGroupManager;
import com.probiz.estore.content.dao.NewsletterGroupDao;


/**
 * Manager implementation for NewsletterGroup, responsible for business processing, and communicate between web and persistence layer.
 */
public class NewsletterGroupManagerImpl extends GenericManagerImpl<NewsletterGroup> implements NewsletterGroupManager {

	private NewsletterGroupDao newsletterGroupDao = null;

	/**
	 * @param newsletterGroupDao
	 *            the newsletterGroupDao to set
	 */
	public void setNewsletterGroupDao(NewsletterGroupDao newsletterGroupDao) {
		this.newsletterGroupDao = newsletterGroupDao;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#init()
	 */
	@Override
	protected void initManager() {
		dao = newsletterGroupDao;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#preDelete(java.lang.Object)
	 */
	@Override
	protected void preDelete(NewsletterGroup entity) {

	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.probiz.estore.core.service.impl.GenericManagerImpl#preSave(java.lang.Object)
	 */
	@Override
	protected void preSave(NewsletterGroup entity) {

	}
	
	/**
	 * 获取所有已激活的可在前台显示的消息组列表
	 * @return
	 */
	public List<NewsletterGroup> getAllActiveNewsletterGroupList(){
		return newsletterGroupDao.getAllNewsletterGroupList(Constants.STATUS_ACTIVE);
	}
	
	/**
	 * 获取所有可以前台显示的消息组列表
	 * @return
	 */
	public List<NewsletterGroup> getAllNewsletterGroupList(){
		return newsletterGroupDao.getAllNewsletterGroupList(null);
	}

}
